import React from 'react';
import { getRoutesContainsSelf } from "../../utils/utils";
import Route from "./Route";
import Switch from "./Switch";
export default function getTabRoutes() {
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
      pane = _ref.pane,
      routerData = _ref.routerData,
      NotFound = _ref.NotFound,
      menu = _ref.menu,
      activeTabKey = _ref.activeTabKey,
      pathname = _ref.pathname;

  var tabKey = pane.key,
      tabPath = pane.path;
  var matchRoutes = getRoutesContainsSelf(tabKey, routerData).map(function (item) {
    return /*#__PURE__*/React.createElement(Route, {
      key: item.key,
      path: item.path,
      exact: item.exact,
      component: item.component
    });
  });

  if (menu.length !== 0 && !routerData[pathname]) {
    matchRoutes.push( /*#__PURE__*/React.createElement(Route, {
      render: NotFound
    }));
  }

  return /*#__PURE__*/React.createElement(Switch, {
    tabKey: tabKey,
    activeTabKey: activeTabKey,
    tabPathname: tabPath,
    key: tabKey
  }, matchRoutes);
}